home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PCMania 36
/
PCMania CD36_1.iso
/
djgpp
/
djgpp.faq
< prev
next >
Wrap
Text File
|
1994-05-10
|
14KB
|
263 lines
Q: What's the minimum set of .zip files I need for compiling programs?
A: djeoeXXX, djdevXXX, gccXXXbn, gasXXXbn, and bnuXXbn are required. The
remainder are for additional functionality. Note that the version
numbers do not neccessarily match between FSF programs (gas and gcc)
and my programs (go32). You'll also need bsnXXXbn for bison and
flxXXXbn for flex, where XXX is the version number.
Note that C++ requires gppXXX.zip, and ObjectiveC requires objcXXX.zip.
The C++ library includes obstacks, alloca, and regex, so you need to
get gppXXX.zip to use them (libgpl.a)
Q: I need 1.11.maint1!
A: Get and install dj111m1.zip (and dj111m2.zip, etc). These are
maintainence releases, and include updates to go32 and other programs.
They should be installed in order and after all other modules.
Q: What about documentation?
A: Get txiXXX.bn, which includes INFO.EXE. Unpack it and run "info". It
will bring up a (hopefully) self-explanatory online help system.
For go32 and programs I wrote, get djdocXXX.zip, which includes the
data files for the online help system.
For the FSF utilities, djgpp includes three files each. Example:
gcc257bn.zip - binaries & source diffs for gcc 2.5.7
gcc257dc.zip - documentation for gcc 2.5.7
gcc257sr.zip - original FSF sources for gcc 2.5.7
(Some sources are too big, and are split into multiple zips, all
of which must be unzipped to get a complete source distribution:
gcc257s1.zip
gcc257s2.zip
gcc257s3.zip
All sources are shipped in ready-to-build form. The diffs in
the diffs directory have already been applied.)
Q: How do I find out what go32 is doing?
A: The first thing to do is run "go32". It will give you gobs of
information about what it knows about your system and itself.
Next, set the "topline" flag in the GO32 environment varable
(see the README) and watch the top line of your screen. The
info there tells you something about what the program is doing.
Q: I get errors I can't figure out when I try to compile something.
A: The best way to figure out what's going wrong with gcc is to
use the "-v" switch. For example, if you run "gcc -v hello.c"
(assuming you have hello.c), it will tell you all the programs
it is running. Then, you can see which program caused the
error. The most likely cause of errors relating to missing
programs is that you haven't unpacked the zip file with
one of the compiler passes or utilities on it.
Q: Why do I get so many unresolved symbols when linking C++ programs?
A: The C++ libraries are not in libc.a, which is the only default
library. You must use a command like this:
gcc -o prog prog.o -lgpp -lm
Note that some C++ classes use math routines, so the -lm should be
given after the -lgplus. If you don't link with -lgpl or -lgpp,
you won't include any GPL code in your application. You may not
need all of these libraries for your program.
Q: How do I debug my programs?
A: First, remember to use the -g switch when you compile. This puts debugging
information into your executable. Then, to debug the program, use a
command line like this:
go32 -d edebug32 myprog
"edebug32" is the external debugger. See the file "edebug32.doc" for
information on the debugger commands. Note: if you are running in a
DPMI environment, you must use "ed32-dpmi" instead of "edebug32". Go32
normally searches relative to the current directory, then from it's own
directory, then the PATH, for the external debugger program.
Q: When I run my programs under Windows, they crash, but not outside of
Windows.
A: You may have used the "-fomit-frame-pointer" option to GCC. This
tells gcc that it can use EBP as a general register. However, the
segment used for the stack is protected against access outside of
calculated stack range, and EBP causes the stack selector to be used.
If you use this to access memory in the regular data area, you get
a protection fault. This mechanism is present to prevent you from
using so much stack that you begin corrupting data. Outside of
Windows, a different method is used to detect stack overrun, so you
don't see this fault.
Q: How do I create symbolic links?
A: Copy bin/stub.exe to the name of the link you want. In this example,
let's say the real program is dj1.exe and we want to make a link called
dj2.exe that really calls dj1.exe. We'd copy stub.exe to dj2.exe.
Next, run stubedit to modify the new programs' stub info block to change
the name of the executable it runs. In this case, we'd change it to
dj1. When you run dj2 now, it tells go32 to use the image of dj1.
C:\> copy c:\djgpp\bin\stub.exe c:\usr\bin\dj2.exe
C:\> stubedit c:/usr/bin/dj2.exe runfile=dj1
Q: When I run "gcc e:\proj\prog.c" it says "undefined escape sequence \p"?
A: Gcc is a *unix* compiler - you must use *unix* slashes (e:/proj/prog.c).
Environment variables (like GCCINC) may, however, use either, as they
are converted.
Q: I type "GCC PROG.C" and ld complains about PROG.C not being an object.
Q: I type "gcc prog.cxx" to compile a C++ program, and ld complains.
A: Gcc is *not* case insensitive like DOS is, and it uses the file's
extension to determine how to compile a file. Valid extensions are:
.cc = C++ source (passed through cpp)
.c = C source that must be passed through cpp first
.i = raw C source (no cpp pass)
.S = assembler that must be passed through cpp first
.s = raw assembler source (no cpp pass)
any other file is passed to the linker
Q: I compile my program, but can't run the output file.
A: DOS doesn't know how to run unix-style COFF files. That's what the
extender is for. To run an COFF file called myprog, type
"go32 myprog . . ."
Q: I compile my program, but when I run the .exe it hangs.
A: Most likely, you did this: "gcc foo.c -o foo.exe". This doesn't
create a real .EXE file. That's like renaming your phone directory
file to an .EXE and expecting it to run. You must use the COFF2EXE
program to convert the output of gcc to a real executable.
Q: Gcc doesn't recognize // as a comment in my C programs.
A: That's because // isn't a comment in C. If you want to compile C++,
then write C++ programs. Gcc is really two compilers in one, not
one compiler that compiles both C and C++. That's why you get
cc1 and cc1plus.
Q: I'm reading in data files, but the data gets corrupted.
A: The default file type is DOS text, even for read() and write(). You must
tell the system that a file is binary through the "b" flag in fopen(),
or O_BINARY in open() or setmode().
Q: I get "fatal signal 2" when I run gcc.
A: When gcc reports a "signal", it really means that an error occurred
trying to run the given program. The "signal" number is the DOS error
code, and 2 means "file not found". Check the COMPILER_PATH environment
variable and make sure it points to the directory with cpp.exe,
cc1.exe, etc.
Q: The binaries I get with the distribution are .exe files, but gcc creates
COFF files. I rename the COFF's to .EXE's, but they still don't work.
A: To get an .EXE from an COFF, you must *prepend* either go32.exe
or stub.exe to the file. A program called "coff2exe" is provided to
do this. Just run "coff2exe myprog".
Q: What is stub.exe?
A: Stub.exe simply calles go32.exe, and passes it information it needs to
run the COFF file attached to it. Stub is much smaller than go32, so
less disk space is used. Also, if you change go32, you don't have to
change stub, and all the stub-ized programs will use the new go32
automatically.
Q: I want to change cc1. How do I do this?
A: First, get the GNU sources. These should be the "gccXXXsr.zip"
files found in the djgpp distribution. You can also get the latest
versions from the FSF if you like. They're usually available at
prep.ai.mit.edu in /pub/gnu, if not elsewhere. djgpp includes a
copy of gzip (gzp124bn.zip) that can uncompress them. Use
djtarx to un-tar them, as djtarx knows how to handle unix file names
that aren't valid DOS file names. Next, apply the "diffs" (if any)
over the GNU sources (making sure you have the right version of GNU
- see the versions file). For most GNU utilities, you must run
"configure" to prepare the sources for a native go32 build before
building. For all other programs, just run make. Note that the makefiles
are tuned for gnu make, since it knows how to handle long command lines.
Specific instructions are documented in the diffs or in each program's
configure.bat.
Q: I don't have an 80387. How do I compile floating point programs?
A: Add "emu c:\djgpp\bin\emu387" to the GO32 environment variable
(see go32 section in readme). This tells go32 to use the given file
as an 80387 emulator. If you don't load this emulator, and you try
to run floating point without a 387, you will get an error.
Q: I installed an 80387 emulator in my AUTOEXEC, but it still doesn't
work. Why?
A: The CPU is running in *protected* mode, not real mode, and the information
needed to emulate the 80387 is different. Not to mention that the
exceptions never get to the real-mode handler. You must use the emu387
emulator, which is designed for go32.
Q: Can I run this on my 286? It has protected mode also...
A: True, but the 286 isn't a 32-bit processor. A 386 really is required.
Q: Can I use gcc on my 512K machine?
A: Yes, but the disk better have at least 4Mb of free space for paging.
Go32 will use all available extended memory (up to 128M) and up to
128M of disk space, for a grand total of 256M of virtual memory for
your application. Try a malloc(50*1024*1024) some day.
Q: Why do my compiles are running VERY SLOW, even though I use a ramdisk
for swap and a disk cache?
A: Gcc requires at least 1Mb of virtual memory to run, usually close to 1.5M.
If there isn't this much real memory available, it starts paging to disk.
It's good to leave about 1M of extended (not expanded) memory available
for go32 to run programs with. When it needs to page a lot, you spend
most of your time paging and little time actually running. Note that
if you are running with a VCPI server, like QEMM or 386MAX, then go32
will use *expanded* memory for it's physical memory needs, not
extended.
Q: How much memory is available when I use the system() call?
A: Everything but what go32 is loaded with. The program is completely
paged out to memory (including the page tables themselves) before
the second program is executed. Currently, this is about 100K
less than was available before go32 was executed.
Q: Go32 complains that the CPU must be in V86 mode to run.
A: When the CPU is in V86 mode, the V86 manager must provide VCPI
services for go32. Since VCPI is an extension to EMS, disabling EMS
will disable VCPI, and prevent go32 from running. For some EMS
managers, this means that you can't use the "noems" switch.
Q: Why can't I keep QEMM in auto/off mode?
A: When QEMM is in auto/off mode and there isn't anything in the system that
is using any of QEMM's features, the CPU remains in "real" mode. Go32
knows this, and will try to use XMS to access the extended memory.
Unfortunately, XMS is a feature that causes QEMM to turn on, and go32
doesn't know this and when it tries to switch into protected mode,
QEMM traps it and gives a protection violation warning. Since this
always requires a system reboot to fix, go32 checks to see if enabling
XMS caused the cpu to switch into v86 mode (meaning QEMM just turned
on) and gracefully exits. All you have to do to work around this is
force QEMM to be on all the time so that go32 will know how to work
with it properly.
Q: How do globbing and response files work?
A: A response file is a file that contains stuff that goes on the command
line, but is too big for DOS. The name of the file is given as "@file"
to any COFF program, and go32 reads the file for command line
information. It uses single and double quotes to group parameters, and
backslashes to escape quotes, spaces, tabs, newlines, and backslashes.
Parameters containing wildcards are expanded if they can be, else they
are unmodified. Surrounding a parameter in single quotes will prevent
wildcards from being expanded. This is similar to unix. Note that
backslashes are not special if they are not in front of a quote,
whitespace, or backslash.
Q: What is GCC-RM? How do I use it?
A: GCC is merely a driver program which calls the CCP, CC1, AS, LD images.
The real-mode gcc is simply gcc itself compiled with Turbo-C instead of
Gcc. This improves compile times on most systems, but isn't as
"clean" as the 32-bit compiled version, and also the 32-bit version
can be recompiled (FSF desires) without having to purchase a new
compiler. Both versions should produce exactly the same output, but
if you have any problems (such as under Novell) use the 32 bit version.
You can either put GCC-RM in your path and issue GCC as your compile
command, or copy it to the bin directory (saving the 32 bit GCC.EXE first).
GCC-RM does not create 16 bit code, or allow the compiler to work on
16 bit only machines.
Q: Is GDB available for DJGPP?
A: No, but if you'd like to work on porting it, let me know :-)
Q: Where is the "make" utility?
A: mak369bn.zip contains the make utility.
Q: Why can't I get segment registers to work in go32 programs?
A: Because segments work differently in protected mode. For most cases, you
will not need to use segments. The "small" model allows up to
2 Gb of data space before you run out, so there's no need
for far pointers anyway.